package com.hp.bon.sgw.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * 提供获取Spring 上下文的工具类，需要初始加载(lazy-init=false)
 * 
 * @author wuzhih
 * 
 */
public class ApplicationContextProvider implements ApplicationContextAware {
	private static ApplicationContext appCtx = null;

	public static ApplicationContext getApplicationContext() {
		return appCtx;
	}

	public void setApplicationContext(ApplicationContext applicationContext)
			throws BeansException {
		// Assign the ApplicationContext into a static variable
		appCtx = applicationContext;
	}
}
